sp_babelfish_configure 'escape_hatch_unique_constraint', 'ignore';
GO

CREATE TABLE babel_3571_11 (id1 INT UNIQUE, id2 VARCHAR(30) UNIQUE, id3 VARBINARY(30))
GO
CREATE TABLE babel_3571_12 (id1 INT, id2 VARCHAR(30), id3 VARBINARY(30), UNIQUE(id1, id2))
GO
CREATE TABLE babel_3571_13 (id1 INT, id2 VARCHAR(30), id3 VARBINARY(30))
GO
CREATE UNIQUE INDEX babel_3571_13_unique_idx ON babel_3571_13(id1, id2)
GO


-- Repeat same tests but with more table/column specification
CREATE TABLE babel_3571_21 (id1 INT NOT NULL UNIQUE NULL, id2 VARCHAR(30) UNIQUE, id3 VARBINARY(30) PRIMARY KEY)
GO
CREATE TABLE babel_3571_21 (id1 INT NOT NULL UNIQUE, id2 VARCHAR(30) UNIQUE NOT NULL, id3 VARBINARY(30) PRIMARY KEY)
GO
CREATE TABLE babel_3571_22 (id1 INT, id2 VARCHAR(30), id3 VARBINARY(30), UNIQUE(id1, id2), PRIMARY KEY (id3))
GO
CREATE TABLE babel_3571_23 (id1 INT, id2 VARCHAR(30), id3 VARBINARY(30))
GO
ALTER TABLE babel_3571_23 ADD CONSTRAINT babel_3571_23_pkey PRIMARY KEY (id3)
GO
ALTER TABLE babel_3571_23 ADD CONSTRAINT babel_3571_23_unique_idx UNIQUE (id1, id2)
GO


-- CREATE TABLE WITH CONSTRAINT -- DROP COLUMN -- ADD COLUMN WITHOUT CONTRAINT
CREATE TABLE babel_3571_31 (id1 INT UNIQUE, id2 int)
GO
CREATE TABLE babel_3571_32 (id1 INT, UNIQUE(id1), id2 int)
GO
CREATE TABLE babel_3571_33 (id1 INT, id2 int)
GO
CREATE UNIQUE INDEX babel_3571_33_unique_idx ON babel_3571_33(id1)
GO

ALTER TABLE babel_3571_31 DROP COLUMN id1;
ALTER TABLE babel_3571_32 DROP COLUMN id1;
ALTER TABLE babel_3571_33 DROP COLUMN id1;
GO

ALTER TABLE babel_3571_31 ADD id1 INT;
ALTER TABLE babel_3571_32 ADD id1 INT;
ALTER TABLE babel_3571_33 ADD id1 INT;
GO


-- Test with identity column
CREATE TABLE babel_3571_41 (id1 INT IDENTITY UNIQUE, id2 int)
GO
CREATE TABLE babel_3571_42 (id1 INT IDENTITY, UNIQUE(id1), id2 int)
GO
CREATE TABLE babel_3571_43 (id1 INT IDENTITY, id2 int)
GO
CREATE UNIQUE INDEX babel_3571_43_unique_idx ON babel_3571_43(id1)
GO